<template>
  <section class="insightd-pages-login">
    <div class="login-wrap">
      <p class="login-logo">
        Vue-Auth
      </p>
      <p class="login-prompt">Try to login with jwt</p>
      <div class="login-form">
        <div class="form-group-a">
          <input id="acc-name" name="erpUserName" type="text" placeholder="用户名" />
        </div>
        <div class="form-group-a">
          <input id="acc-pwd" name="erpPassword" type="password" placeholder="密码" />
        </div>
        <div class="form-group-c">
          <p id="form-submit" class="form-submit" @click="doLogin">登录</p>
        </div>
      </div>
    </div>
  </section>
</template>

<script>
import { mapGetters, mapActions } from 'vuex'
import { userApi } from '@/network'
export default {
  name: 'Login',
  mounted () {
    
  },
  methods: {
    ...mapActions(['login']),
    doLogin () {
      this.login({
        username: 'xie',
        password: 'xieyu19901004'
      })
      .then(() => {
        let target = this.$route.query.redirect
        this.$router.push(target || 'm2')
      })
    }
  }
}
</script>

<style lang="less">
.insightd-pages-login {
  position: relative;
  display: flex;
	width: 100%;
  height: 100%;
  padding-bottom: 80px;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  background-color: #f1f1f1;
}

.insightd-pages-login .login-wrap {
  display: flex;
  flex-direction: column;
  flex-basis: 35.625rem;
  height: 39rem;
  justify-content: center;
  align-items: center;
  background-color: #fff;
  border: 1px solid #bbb;
}

.insightd-pages-login .login-wrap .login-logo {
  margin: 0;
  width: 6.25rem;
  height: 6.25rem;
  text-align: center;
  line-height: 6.25rem;
  border-radius: 0.25rem;
  font-size: 1.25rem;
  color: #fff;
  background-color: #556eef;
}

.insightd-pages-login .login-wrap .login-prompt {
  line-height: 4rem;
  text-align: center;
  margin: 0 0 1.875rem;
  color: #556eef;
}

.insightd-pages-login .login-wrap .login-form {
  width: 28.75rem;
}

.insightd-pages-login .login-wrap .form-group-a {
  display: flex;
  width: 100%;
  height: 3.75rem;
  margin-bottom: 1rem;
  border: 1px solid #d9d9d9;
}

.insightd-pages-login .login-wrap .form-group-a input[type='text'],
.insightd-pages-login .login-wrap .form-group-a input[type='password'] {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: none;
  text-align: center;
  line-height: 3rem;
  padding: 0.3125rem 1rem;
  font-size: 1.125rem;
  color: #aaa;
}

.insightd-pages-login .login-wrap .form-group-b {
  display: flex;
  width: 100%;
  height: 3.75rem;
  margin-bottom: 2.5rem;
}

.insightd-pages-login .login-wrap .form-group-b .inp-con{
  display: flex;
  flex: 1;
  border: 1px solid #d9d9d9;
}

.insightd-pages-login .login-wrap .form-group-b input[type='text'] {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: none;
  text-align: center;
  line-height: 3rem;
  padding: 0.3125rem 1rem;
  font-size: 1.125rem;
  color: #aaa;
}

.insightd-pages-login .login-wrap .form-group-b .pic-con {
  flex-basis: 9.375rem;
  margin-left: 0.625rem;
  flex-shrink: 0;
  flex-grow: 0;
}

.insightd-pages-login .login-wrap .form-group-b img {
  display: block;
  width: 100%;
  height: 100%;
}

.insightd-pages-login .login-wrap .form-group-c {
  display: flex;
  flex-basis: 3.75rem;
  text-align: center;
  line-height: 3.75rem;
}

.insightd-pages-login .login-wrap .form-group-c .form-submit {
  flex: 1;
  margin: 0;
  cursor: pointer;
  font-size: 1.5rem;
  color: #fff;
  background-color: #556eef;
}
</style>
